package main

import (
	"haili/common"
	"html/template"

	"github.com/lunny/tango"
	"github.com/tango-contrib/cache"
	"github.com/tango-contrib/captcha"
	"github.com/tango-contrib/renders"
)

var a = cache.NewMemoryCacher()

func main() {

	t := tango.Classic()
	Router(t)
	t.Use(captcha.New(captcha.Options{
		URLPrefix:        "/captcha/",    // URL prefix of getting captcha pictures.
		FieldIdName:      "captcha_id",   // Hidden input element ID.
		FieldCaptchaName: "captcha_name", // User input value element name in request form.
		ChallengeNums:    5,              // Challenge number.
		Width:            150,            // Captcha image width.
		Height:           50,             // Captcha image height.
		Expiration:       60,             // Captcha expiration time in seconds.
		CachePrefix:      "captcha_",     // Cache key prefix captcha characters.

	}))
	t.Use(common.MyHandler())
	t.Use(renders.New(renders.Options{
		Reload:    true,          // if reload when template is changed
		Directory: "./templates", // Directory to load templates
		Funcs: template.FuncMap{
			"test": func() string {
				return "test"
			},
		},
		// Vars is a data map for global
		// Vars is a data map for global
		Vars: renders.T{
			"var": "var",
		},
		Charset: "UTF-8", // Appends the given charset to the Content-Type header. Default is UTF-8
		// Allows changing of output to XHTML instead of HTML. Default is "text/html"
		HTMLContentType: "text/html",
		DelimsLeft:      "{{",
		DelimsRight:     "}}", // default Delims is {{}}, if it conflicts with your javascript template such as angluar, you can change it.
	}))

	t.Run()
}
